package br.com.blog.acoes;

import org.jboss.seam.ScopeType;
import org.jboss.seam.annotations.In;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Scope;
import org.jboss.seam.security.Credentials;
import org.jboss.seam.security.Identity;

/**
 *
 * @author Guilherme Parente Costa
 */
@Name("loginAction")
@Scope(ScopeType.EVENT)
public class LoginAction extends ActionPadrao {

    private static final long serialVersionUID = -6158417211574116033L;
    @In
    Credentials credentials;
    @In
    Identity identity;

    public boolean autenticar() {
        if (credentials.getUsername().equals("teste") && credentials.getPassword().equals("teste")) {
            identity.addRole("teste");
            return true;
        }
        return false;
    }

}
